<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
	<script src="https://cdn.bootcss.com/vue/2.2.6/vue.min.js"></script>
</head>
<body>
<div id="test">
	<template v-if="loginType === 'username'">
		<label>Username</label>
		<input placeholder="输入你的用户名" key="username-input">
	</template>
	<template v-else>
		<label>password</label>
		<input placeholder="输入你的密码" key="email-input">
	</template>
	<button @click="toggleLoginType">按钮</button>
</div>

<script>
	var vm = new Vue({
		el: '#test',
		data: {
			loginType: 'username'
		},
		methods: {
			toggleLoginType: function() {
				return this.loginType = this.loginType === 'username' ? 'email-input' : 'username-input';
			}
		}
	});
</script>
</body>
</html>